﻿<Window x:Class="TextAnalyzer.ConfigurationDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:sys="clr-namespace:System;assembly=mscorlib" 
        xmlns:this="clr-namespace:TextAnalyzer" 
        Title="설정" Height="400" Width="700" WindowStyle="ToolWindow" ShowInTaskbar="False">
    <Window.Resources>
        <ObjectDataProvider x:Key="searchTypeProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="this:SearchType" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.6*" />
            <ColumnDefinition Width="0.4*" />
            <ColumnDefinition Width="0.4*" />
        </Grid.ColumnDefinitions>
        <GroupBox Header="구분 정보" Grid.Column="0" Margin="5">
            <DataGrid Name="dataGridKeys" AutoGenerateColumns="False" ItemsSource="{Binding Keys,UpdateSourceTrigger=PropertyChanged}" CanUserDeleteRows="True" CanUserAddRows="True" SelectionMode="Single" Margin="5">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="속성" Width="Auto" Binding="{Binding Key,UpdateSourceTrigger=PropertyChanged}" />
                    <DataGridTextColumn Header="표 제목" Width="*" Binding="{Binding Header,UpdateSourceTrigger=PropertyChanged}" />
                    <DataGridComboBoxColumn Header="인식 방법" Width="Auto" ItemsSource="{Binding Source={StaticResource searchTypeProvider}}" SelectedItemBinding="{Binding Type,UpdateSourceTrigger=PropertyChanged}" />
                    <DataGridCheckBoxColumn Header="기준" Width="Auto" Binding="{Binding Entry,UpdateSourceTrigger=PropertyChanged}" />
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <GroupBox Header="인식 단어" Grid.Column="1" Margin="5">
            <Grid Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <ComboBox Margin="5" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalAlignment="Stretch" VerticalContentAlignment="Center" ItemsSource="{Binding PostfixParents}" SelectedItem="{Binding PostfixParent,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Key" />
                <ListBox Name="listBoxPostfix" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding PostfixView}" Grid.Row="1">
                    <ListBox.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="단어 추가" Click="OnClickButtonAddPostfix" />
                            <MenuItem Header="단어 삭제" Click="OnClickButtonDeletePostfix" />
                        </ContextMenu>
                    </ListBox.ContextMenu>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBox Text="{Binding Value,Mode=TwoWay}" Grid.Column="0" />
                                <CheckBox Grid.Column="1" IsChecked="{Binding CaseComparison}" />
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </GroupBox>
        <GroupBox Header="구분 단어" Grid.Column="2" Margin="5">
            <Grid Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <ComboBox Margin="5" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalAlignment="Stretch" VerticalContentAlignment="Center" ItemsSource="{Binding CategoryParents}" SelectedItem="{Binding CategoryParent,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Key" />
                <ListBox Name="listBoxCategory" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding CategoryView}" Grid.Row="1">
                    <ListBox.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="단어 추가" Click="OnClickButtonAddCategory" />
                            <MenuItem Header="단어 삭제" Click="OnClickButtonDeleteCategory" />
                        </ContextMenu>
                    </ListBox.ContextMenu>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBox Text="{Binding Category,Mode=TwoWay}" Grid.Column="0" />
                                <CheckBox Grid.Column="1" IsChecked="{Binding CaseComparison}" />
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </GroupBox>
    </Grid>
</Window>
